﻿using System.Collections.Specialized;
using System.Linq;
using System.Web.Mvc;
using Newtonsoft.Json;

namespace Ha666.WebUI.Controllers
{
    public class TeegonController : Controller
    {

        private static log4net.ILog Logger = log4net.LogManager.GetLogger(typeof(TeegonController));

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult ReturnUrl()
        {
            NameValueCollection requests = Request.Form;
            Logger.InfoFormat("【ReturnUrl】：IP：{0}\r\nMethod：{1}\r\nRequest：{2}\r\nForm：{3}", Request.UserHostAddress, Request.HttpMethod, Request.RawUrl, JsonConvert.SerializeObject(requests.AllKeys.ToDictionary(key => key, key => requests[key])));
            return new EmptyResult();
        }

        public ActionResult NotifyUrl()
        {
            NameValueCollection requests = Request.Form;
            Logger.InfoFormat("【NotifyUrl】：IP：{0}\r\nMethod：{1}\r\nRequest：{2}\r\nForm：{3}", Request.UserHostAddress, Request.HttpMethod, Request.RawUrl, JsonConvert.SerializeObject(requests.AllKeys.ToDictionary(key => key, key => requests[key])));
            return new EmptyResult();
        }

    }
}
